# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gdm
pkgver=3.36.3
pkgrel=0
pkgdesc="GNOME display manager"
url="https://wiki.gnome.org/Projects/GDM"
arch="all !armhf !s390x !ppc64le !mips !mips64"
license="GPL-2.0-or-later"
depends="dconf linux-pam gnome-settings-daemon gnome-shell xorg-server
	xorg-server-xwayland xrdb gsettings-desktop-schemas gnome-session"
makedepends="dconf-dev gnome-desktop-dev accountsservice-dev libcanberra-dev linux-pam-dev
	intltool itstool libxml2-utils libsm-dev iso-codes nss-dev upower-dev elogind-dev"
subpackages="$pkgname-dev $pkgname-lang $pkgname-openrc"
options="!check" # Causes circular dep with gnome-shell
source="https://download.gnome.org/sources/gdm/${pkgver%.*}/gdm-$pkgver.tar.xz
	gdm.initd
	Xsession"
install="gdm.pre-install"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-static \
		--without-plymouth \
		--with-initial-vt=1 \
		--enable-wayland-support \
		--without-tcp-wrappers \
		--with-pid-file=/var/run/gdm.pid \
		--enable-authentication-scheme=pam \
		--with-default-pam-config=arch \
		--with-log-dir=/var/log/gdm \
		--with-pam-mod-dir=/lib/security
	make
}

package() {
	make DESTDIR="$pkgdir" install

	sed -i "s/pam_systemd\.so/pam_elogind.so/" "$pkgdir"/etc/pam.d/*

	install -m755 -D "$srcdir/Xsession" "$pkgdir"/etc/gdm
	install -m755 -D "$srcdir/$pkgname.initd" "$pkgdir"/etc/init.d/gdm
}

sha512sums="21c3bba0ce5142362e3c86ccb05fc234d9356db295ed63f3c383bd7cc2b7a464bdcec08e472d31a339b5ffbfeaed4db72ebbdeae2e7a71effdeef8c52b53830b  gdm-3.36.3.tar.xz
cd4c8f80e37dc362727bd535cbe1d3917f2bc47d52af717595e19709051ab5f27c0f650195152ccd1a7e5e2f886e4e8bc60287f05dcd81e84237c7f78c89223f  gdm.initd
f836cf0acdf148f2ae09ac28251b5126ce597f08254c43b1ec77596f75e1a3229926116c13f98554625be763e8d28415b27bd679b0a5de9f86bdca7857054c82  Xsession"
